<script type="text/javascript">
function PhotographerDiscountController(aStartingDiscount){
	
	var startingDiscount = aStartingDiscount;
	
	
	var groupDiscountAmountPrice = jQuery('#groupDiscountAmountPrice')
	var groupDiscountAmountPhotos = jQuery('#groupDiscountAmountPhotos')
	
	var radioDiscountAmountPrice = jQuery('#optionDiscountAmountPrice');
	var radioDiscountAmountPhotos = jQuery('#optionDiscountAmountPhotos');
	var radioNoDiscount = jQuery('#optionNoDiscount');
	
	var discountAmountPhotosPercentage = jQuery('#discountAmountPhotosPercentage');
	var discountAmountPhotos = jQuery('#discountAmountPhotos');
	
	var discountAmountPricePercentage = jQuery('#discountAmountPricePercentage');
	var discountAmountPrice = jQuery('#discountAmountPrice');
	
	function init(){
		
		switch(parseInt(startingDiscount))
		{
		case 1:
			radioNoDiscount.attr('checked',true);			
			break;
		case 2:
			radioDiscountAmountPhotos.attr('checked',true);			
			break;
		case 3:
			radioDiscountAmountPrice.attr('checked',true);			
			break;
		default:
		  alert("ERROR");
		}
		
		
		if (radioDiscountAmountPrice.attr("checked") != "undefined" && radioDiscountAmountPrice.attr("checked") == "checked")
			setDiscountAmountPriceVisibility();

		if (radioDiscountAmountPhotos.attr("checked") != "undefined" && radioDiscountAmountPhotos.attr("checked") == "checked")
			setDiscountAmountPhotosVisibility();
		
		if (radioNoDiscount.attr("checked") != "undefined" && radioNoDiscount.attr("checked") == "checked")
			setNoDiscountVisibility();
		
		
		radioDiscountAmountPrice.click(function(){
			setDiscountAmountPriceVisibility();
		});
		
		radioDiscountAmountPhotos.click(function(){
			setDiscountAmountPhotosVisibility();
		});
		
		radioNoDiscount.click(function(){
			setNoDiscountVisibility();
		});		
	}
	
	function setDiscountAmountPriceVisibility(){
		//groupDiscountAmountPrice.show();
		//groupDiscountAmountPhotos.hide();
		discountAmountPrice.removeAttr('disabled');
		discountAmountPricePercentage.removeAttr('disabled');
		
		discountAmountPhotos.attr('disabled','disabled');
		discountAmountPhotosPercentage.attr('disabled','disabled');
		discountAmountPhotos.val('');
		discountAmountPhotosPercentage.val('');
	}
	
	function setDiscountAmountPhotosVisibility(){
		//groupDiscountAmountPrice.hide();
		//groupDiscountAmountPhotos.show();
		discountAmountPhotos.removeAttr('disabled');
		discountAmountPhotosPercentage.removeAttr('disabled');
		
		
		discountAmountPricePercentage.attr('disabled','disabled');
		discountAmountPrice.attr('disabled','disabled');
		discountAmountPricePercentage.val('');
		discountAmountPrice.val('');
		
	}
	
	function setNoDiscountVisibility(){
		//groupDiscountAmountPrice.hide();
		//groupDiscountAmountPhotos.hide();
		discountAmountPricePercentage.attr('disabled','disabled');
		discountAmountPrice.attr('disabled','disabled');
		discountAmountPhotos.attr('disabled','disabled');
		discountAmountPhotosPercentage.attr('disabled','disabled');		
		discountAmountPricePercentage.val('');
		discountAmountPrice.val('');
		discountAmountPhotos.val('');
		discountAmountPhotosPercentage.val('');
	}
	
	init();
	
}
</script>